home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / Windows_Re190765712005.psc / Registry Fixer / frmRestore.frm < prev    next >
Text File  |  2005-06-30  |  4KB  |  106 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Begin VB.Form frmRestore 
  4.    Caption         =   "Restore Registry Backups"
  5.    ClientHeight    =   4245
  6.    ClientLeft      =   60
  7.    ClientTop       =   750
  8.    ClientWidth     =   6795
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4245
  11.    ScaleWidth      =   6795
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.FileListBox fleBackups 
  14.       Height          =   2235
  15.       Left            =   0
  16.       Pattern         =   "*.reg"
  17.       TabIndex        =   1
  18.       Top             =   0
  19.       Visible         =   0   'False
  20.       Width           =   2415
  21.    End
  22.    Begin MSComctlLib.ListView lvwRegBackups 
  23.       Height          =   4215
  24.       Left            =   -120
  25.       TabIndex        =   0
  26.       Top             =   0
  27.       Width           =   6735
  28.       _ExtentX        =   11880
  29.       _ExtentY        =   7435
  30.       LabelWrap       =   -1  'True
  31.       HideSelection   =   -1  'True
  32.       Checkboxes      =   -1  'True
  33.       FullRowSelect   =   -1  'True
  34.       GridLines       =   -1  'True
  35.       _Version        =   393217
  36.       ForeColor       =   -2147483640
  37.       BackColor       =   -2147483643
  38.       BorderStyle     =   1
  39.       Appearance      =   1
  40.       NumItems        =   0
  41.    End
  42.    Begin VB.Menu mnuFile 
  43.       Caption         =   "&File"
  44.       Begin VB.Menu mnuRestore 
  45.          Caption         =   "&Restore Backup"
  46.       End
  47.       Begin VB.Menu mnuSeperator 
  48.          Caption         =   "-"
  49.       End
  50.       Begin VB.Menu mnuClose 
  51.          Caption         =   "&Close"
  52.       End
  53.    End
  54. End
  55. Attribute VB_Name = "frmRestore"
  56. Attribute VB_GlobalNameSpace = False
  57. Attribute VB_Creatable = False
  58. Attribute VB_PredeclaredId = True
  59. Attribute VB_Exposed = False
  60. Private Sub Form_Load()
  61. Dim FileName As String
  62. fleBackups.Path = "RegBackups"
  63.     With lvwRegBackups
  64.         .View = lvwReport
  65.         .ColumnHeaders.Add , , "Backup Number"
  66.         .ColumnHeaders.Add , , "Date Created"
  67.         .ColumnHeaders.Add , , "Filesize (in bytes)"
  68.     End With
  69.     For i = 1 To fleBackups.ListCount
  70.     FileName = fleBackups.List(i - 1)
  71.             With lvwRegBackups
  72.             Set lvItm = .ListItems.Add(, , Mid(FileName, 1, InStr(1, FileName, "(") - 2))
  73.             lvItm.SubItems(1) = Mid(Mid(Replace(Replace(FileName, "-", "/"), ";", ":"), 1, Len(FileName) - 5), InStr(1, FileName, "(") + 1)
  74.             lvItm.SubItems(2) = Len(FileName)
  75.         End With
  76.         lvwRegBackups.ListItems.Item(i).Tag = FileName
  77.         Next i
  78.         Me.Move (Screen.Width / 2) - (Me.ScaleWidth / 2), (Screen.Height / 2) - (Me.ScaleHeight / 2)
  79.         LV_AutoSizeColumn lvwRegBackups
  80.                 lvwRegBackups.ColumnHeaders(3).Width = 1500
  81.                 If lvwRegBackups.ListItems.Count = 0 Then MsgBox "Sorry, no backups found.": Unload Me
  82.             Set lvItm = Nothing
  83. End Sub
  84.  
  85. Private Sub Form_Resize()
  86. lvwRegBackups.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
  87. End Sub
  88.  
  89. Private Sub mnuClose_Click()
  90. Unload Me
  91. End Sub
  92.  
  93. Private Sub mnuRestore_Click()
  94. Dim ItemsChecked As Integer
  95. If FileorFolderExists(App.Path & "\RegBackups") = False Then MkDir App.Path & "\RegBackups"
  96. For i = 1 To lvwRegBackups.ListItems.Count
  97. If lvwRegBackups.ListItems.Item(i).Checked = True Then
  98. MsgBox lvwRegBackups.ListItems.Item(i).Tag
  99. Shell "regedit.exe /s" & App.Path & "\RegBackups\" & lvwRegBackups.ListItems.Item(i).Tag
  100. ItemsChecked = ItemsChecked + 1
  101. End If
  102. Next
  103. If ItemsChecked = 0 Then MsgBox "Please click the checkbox(es) next to the item you would like to restore.", vbExclamation, "None Checked"
  104.  
  105. End Sub
  106.